package itcast.web.servlet;

import itcast.domain.Lack;
import itcast.domain.Studnet;
import itcast.service.LackService;
import itcast.service.StudentService;
import itcast.service.impl.LackServiceImpl;
import itcast.service.impl.StudentServiceImpl;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.List;

@WebServlet("/lackServlet")
public class LackServlet extends HttpServlet {
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

        //1.调用studentService完成查询
        LackService service=new LackServiceImpl();
        List<Lack> lacks=service.findlack();
        //2.将list存入request域
        request.setAttribute("lacks",lacks);
        //3.转发到student_manage .jsp
        request.getRequestDispatcher("/dromitory/lack_drom.jsp").forward(request,response);

    }

    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

        this.doPost(request,response);
    }
}
